<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:doc="livcos.org/ns/doc"
	xmlns:j="livcos.org/ns/doc/journal"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:v="livcos.org/ns/view"
	exclude-result-prefixes="doc j xs v">
	
	<xsl:template match="j:journal">
		<v:chapter id="{@id}">
			<v:title><xsl:value-of select="j:title"/></v:title>
			<v:style ref="{resolve-uri('../styles.css')}"/>
			<xsl:apply-templates select="j:entry">
				<xsl:sort select="@time" order="descending" />
			</xsl:apply-templates>
		</v:chapter>
	</xsl:template>
	
	<xsl:template match="j:entry">
		<div id="{@id}">
			<p class="journal_entry_info">
				<xsl:value-of select="format-dateTime(xs:dateTime(@time), '[D].[M].[Y] [H01]:[m01]')" />
			</p>
			<p class="journal_entry_content">
				<span class="inlineEdit"><xsl:apply-templates /></span>
			</p>
		</div>
	</xsl:template>
	
</xsl:stylesheet>
